package com.david.exception;


import com.david.auth.pojo.result.ABizCode;

public class BusinessRuntimeException extends RuntimeException {
    protected ABizCode bizCode;

    public BusinessRuntimeException(Throwable e) {
        super(e);
        bizCode= ABizCode.EXCEPTION;
    }

    public BusinessRuntimeException(ABizCode bizCode) {
        super(bizCode.getMsg());
        this.bizCode=bizCode;
    }

    public BusinessRuntimeException(String message, Throwable e) {
        super(message, e);
        this.bizCode=new ABizCode(ABizCode.FAIL.getCode(),ABizCode.FAIL.getI18nKey(),message);
    }

    public BusinessRuntimeException(ABizCode bizCode, String message) {
        super(message);
        this.bizCode=new ABizCode(bizCode.getCode(),bizCode.getI18nKey(),message);
    }

    public BusinessRuntimeException(ABizCode bizCode, String message, Throwable throwable) {
        super(message, throwable);
        this.bizCode=new ABizCode(bizCode.getCode(),bizCode.getI18nKey(),message);
    }

    public BusinessRuntimeException(String message) {
        super(message);
        this.bizCode=new ABizCode(ABizCode.FAIL.getCode(),ABizCode.FAIL.getI18nKey(),message);
    }

    public ABizCode getResultCode(){
        return this.bizCode;
    }

}
